package rohyunji.swing.outline;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;

import ch.randelshofer.quaqua.QuaquaManager;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;

/*스윙 프로그램 모양과 느낌 변경
* javax.swing.UIManager클래스의 setLookAndFeel 메서드를 사용
* setLookAndFeel 메서드를 사용 
* com.sun.java.swing.plaf.gtk.GTKLookAndFeel
* javax.swing.plaf.metal.MetalLookAndFeel
* com.sun.java.swing.plaf.windows.WindowsLookAndFeel
* com.sun.java.swing.plaf.motif.MotifLookAndFeel
* com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
* 
*JFrame.setDefaultLookAndFeelDecorated(true);
* UIManager.setLookAndFeel(룩앤필명칭);
* MacOSX 와 비슷한 lookandfeel을 제공하는 사이트 
* www.randelshofer.ch/quaqua/
*/

public class J06_HelloSwingLookAndFeel extends JFrame {

	private JPanel contentPane;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
//		quaqua룩앤필 적용  
		System.setProperty("Quaqua.tabLayoutPolicy","wrap");
		
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JFrame.setDefaultLookAndFeelDecorated(true);
					//두번째 방법 
					UIManager.setLookAndFeel(QuaquaManager.getLookAndFeel());
				
					J06_HelloSwingLookAndFeel frame = new J06_HelloSwingLookAndFeel();
					//LookAndFeel지정
//					UIManager.setLookAndFeel(
//					"javax.swing.plaf.metal.MetalLookAndFeel");
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public J06_HelloSwingLookAndFeel() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JLabel lblNewLabel = new JLabel("바보야");
		contentPane.add(lblNewLabel, BorderLayout.CENTER);
		
		JButton btnNewButton = new JButton("천재가되고싶니?클릭");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		contentPane.add(btnNewButton, BorderLayout.EAST);
		
		textField = new JTextField();
		textField.setText("ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ");
		contentPane.add(textField, BorderLayout.SOUTH);
		textField.setColumns(10);
	}

}
